//
//  YDTabBarController.m
//  YDHeBecc
//
//  Created by Tom on 16/5/26.
//  Copyright © 2016年 YDState. All rights reserved.
//

#import "YDTabBarController.h"
#import "YDUserViewController.h"
#import "YDMainViewController.h"
#import "YDNavigationController.h"
#import "YDCommitViewController.h"

@interface YDTabBarController ()

@end

@implementation YDTabBarController


+(instancetype)shareTab{
    
    static YDTabBarController *shareTab;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
        shareTab = [[YDTabBarController alloc]init];
        
        //首页
        YDMainViewController *mainVC = [[YDMainViewController alloc]init];
        YDNavigationController *mainNavi = [[YDNavigationController alloc]initWithRootViewController:mainVC];
        mainNavi.tabBarItem.title = @"首页";
        mainNavi.tabBarItem.image = [[UIImage imageNamed:@"shouye_tab"] imageWithRenderingMode:(UIImageRenderingModeAutomatic)];
        mainNavi.tabBarItem.selectedImage = [[UIImage imageNamed:@"shouye_tab_s"]imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)];
        
        
        //个人
        YDUserViewController *cateVC = [[YDUserViewController alloc]init];
        YDNavigationController *cateNavi = [[YDNavigationController alloc]initWithRootViewController:cateVC];
        cateNavi.tabBarItem.title = @"分类";
        cateNavi.tabBarItem.image = [[UIImage imageNamed:@"fenlei_tab"]imageWithRenderingMode:(UIImageRenderingModeAutomatic)];
        cateNavi.tabBarItem.selectedImage = [[UIImage imageNamed:@"fenlei_tab_s"]imageWithRenderingMode:(UIImageRenderingModeAutomatic)];
        //意见反馈
        YDCommitViewController *planVC = [[YDCommitViewController alloc]init];
        YDNavigationController *planNavi = [[YDNavigationController alloc]initWithRootViewController:planVC];
        planNavi.tabBarItem.image = [[UIImage imageNamed:@"plan_tab"]imageWithRenderingMode:(UIImageRenderingModeAutomatic)];
        planNavi.tabBarItem.selectedImage = [[UIImage imageNamed:@"plan_tab_s"]imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)];
        planNavi.tabBarItem.title = @"结婚";
        //更多
        YDMainViewController *toolVC = [[YDMainViewController alloc]init];
        YDNavigationController *toolNavi = [[YDNavigationController alloc]initWithRootViewController:toolVC];
        toolNavi.tabBarItem.title = @"工具";
        toolNavi.tabBarItem.image = [[UIImage imageNamed:@"gongju_tab"]imageWithRenderingMode:(UIImageRenderingModeAutomatic)];
        toolNavi.tabBarItem.selectedImage = [[UIImage imageNamed:@"gongju_tab_s"]imageWithRenderingMode:(UIImageRenderingModeAutomatic)];
       
        
        shareTab.viewControllers = @[mainNavi,cateNavi,planNavi,toolNavi];
        // shareTab.tabBar.barTintColor = [UIColor whiteColor];
        shareTab.tabBar.tintColor = [UIColor blueColor];
    });
    
    return shareTab;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
